package com.tank.control;


import com.tank.entrity.GameObject;
import com.tank.entrity.Tank;
import com.tank.entrity.Wall;

public class TankWallCollider implements Collider {
    @Override
    public boolean collide(GameObject o1, GameObject o2) {
        if (o1 instanceof Tank && o2 instanceof Wall) {
            if (((Tank) o1).getTankRectangle().intersects(((Wall) o2).getWallRectangle())) {
                ((Tank)o1).back();
            }
        } else if (o2 instanceof Tank && o1 instanceof Wall) {
            collide(o2, o1);
        }
        return false;
    }
}
